package com.meida.boot.handler.collecon;

import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.PageInterceptor;
import com.meida.common.mybatis.model.PageParams;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.cms.client.entity.CmsContent;
import org.springframework.stereotype.Component;

/**
 * 收藏的资讯
 */
@Component("cmsColleconHandler")
public class CmsColleconHandler implements PageInterceptor {

    @Override
    public void prepare(CriteriaQuery cq, PageParams pageParams, EntityMap params) {
        cq.addSelect("content.title", "content.coverImage coverImage");
        cq.eq("targetEntity", CmsContent.class.getSimpleName());
        cq.eq("optType", 1);
        cq.createJoin(CmsContent.class).setMainField("targetId");

    }
}
